package com.longrise.android.byjk.plugins.poster.posterdetail.assist;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by godliness on 2017/9/25.
 */

public final class ImgList<T> {

    /***存放海报，某个类别下的数据结构*/
    private List<T> mRecourseList;

    private ImgList() {
        mRecourseList = new ArrayList<>();
    }

    public static ImgList getInstance() {
        return SingleTon.INSTANCE.getInstance();
    }

    private enum SingleTon {

        INSTANCE;

        private ImgList mPosterList;

        SingleTon() {
            mPosterList = new ImgList();
        }

        private ImgList getInstance() {
            return mPosterList;
        }
    }

    public void clearAll() {
        if (mRecourseList != null) {
            mRecourseList.clear();
        }
    }

    public <P extends List<T>> void addAll(P p) {
        if (mRecourseList != null) {
            mRecourseList.addAll(p);
        }
    }

    public void add(T t) {
        if (mRecourseList != null) {
            mRecourseList.add(t);
        }
    }

    public List<T> getImgs() {
        return mRecourseList;
    }
}
